package com.web.controller;

import javax.annotation.security.RolesAllowed;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.service.impl.ServiceUserImpl;
@Controller
public class WelcomeContoller  extends AbstractController {
	Logger logger = Logger.getLogger(WelcomeContoller.class.getName());
	@Autowired
	private ServiceUserImpl serviceUser;


	@RolesAllowed("ROLE_USER")
	@RequestMapping({"/", "/index"})
	protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		logger.info("handleRequestInternal START");
		serviceUser.createUser();
		ModelAndView view = new ModelAndView("Welcome");
		logger.info("handleRequestInternal END");
		return view;
	}

}
